package github.kawaiior.yuanchuxiuzhen.common.entity.addon.model;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import github.kawaiior.yuanchuxiuzhen.common.entity.addon.RainFrogEntity;
import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.model.ModelRenderer;

public class RainFrogEntityModel extends EntityModel<RainFrogEntity> {

    private final ModelRenderer mainBody;

    public RainFrogEntityModel(){
        this.textureWidth = 16;
        this.textureHeight = 16;

        mainBody = new ModelRenderer(this);
        this.mainBody.setRotationPoint(0.0F, 24.0F, 0.0F);

        this.addBox(0, 0, -2.0F, -3.0F, 0.0F, 4, 3, 4, 0.0F, false);
        this.addBox(0, 0, -1.5F, -4.0F, -1.0F, 3, 3, 4, 0.0F, false);
        this.addBox(0, 0, -3.0F, -2.0F, 1.5F, 1, 2, 3, 0.0F, false);
        this.addBox(0, 0, 2.0F, -2.0F, 1.5F, 1, 2, 3, 0.0F, false);
        this.addBox(0, 0, -1.5F, -4.0F, -3.0F, 3, 2, 2, 0.0F, false);
        this.addBox(0, 0, -0.75F, -4.0F, -4.0F, 1, 1, 1, 0.0F, false);
        this.addBox(0, 0, -0.75F, -4.5F, -2.5F, 2, 1, 4, 0.0F, false);
        this.addBox(0, 0, -3.0F, -1.0F, -3.0F, 1, 1, 2, 0.0F, false);
        this.addBox(0, 0, -2.5F, -2.0F, -1.5F, 1, 1, 1, 0.0F, false);
        this.addBox(0, 0, 1.5F, -2.0F, -1.5F, 1, 1, 1, 0.0F, false);
        this.addBox(0, 0, 2.0F, -1.0F, -3.0F, 1, 1, 2, 0.0F, false);
        this.addBox(4, 14, -1.75F, -5.0F, -3.0F, 1, 1, 1, 0.0F, false);
        this.addBox(0, 14, 0.75F, -5.0F, -3.0F, 1, 1, 1, 0.0F, false);
    }

    private void addBox(int tx, int ty, float x, float y, float z, float width, float height, float depth, float delta, boolean mirrorIn){
        ModelRenderer mr = new ModelRenderer(this);
        this.mainBody.addChild(mr);
        mr.setTextureOffset(tx, ty).addBox(x,y,z,width,height,depth,delta,mirrorIn);
    }

    @Override
    public void setRotationAngles(RainFrogEntity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {

    }

    @Override
    public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
        this.mainBody.render(matrixStack, buffer, packedLight, packedOverlay);
    }
}
